set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# 定义 Python 模块绑定
add_library(KVCacheSDK MODULE       # 绑定代码文件
        src/KVCacheSDK.cpp  # SDK 实现
)

# 包含目录
target_include_directories(KVCacheSDK PRIVATE
        ${CMAKE_CURRENT_SOURCE_DIR}/include  # SDK 头文件
        ${ROOT_DIR}/kvcache-memorypool/include
        ${pybind11_INCLUDE_DIRS}
        ${COMMON_DIR}/include
)

set_target_properties(KVCacheSDK PROPERTIES
        OUTPUT_NAME "KVCacheSDK"          # 生成的模块名（kvcacheSDK.so）
        PREFIX ""                      # 去除 lib 前缀
        SUFFIX ".so"                   # 指定后缀
)

# 链接依赖库
target_link_libraries(KVCacheSDK PRIVATE
        proto-objects
        gRPC::grpc++
        gRPC::grpc++_reflection
        common_lib
)
